package day16;
//通过实现Runnable接口，实现run()完成线程
public class TestRunnable implements Runnable{
    public void run() {
        String name=Thread.currentThread().getName();
        for (int i=0;i<100;i++){
            System.out.println(name+" "+i);
        }
    }

    public static void main(String[] args) {
        //run对象属于Runnable类型的不是线程
        TestRunnable run=new TestRunnable();
        //Thread类型的对象才是线程，才能设置名称和启动线程
        Thread t1=new Thread(run,"李四");
        Thread t2=new Thread(run,"王五");
        t1.start();
        t2.start();
    }
}
